Hypothesis test for equality of two correlation coefficients.
correls2.test(r1, r2, n1, n2, type = "pearson")
The test statistic and its associated p-value for the test of equal correlations.
The value of the first correlation coefficient.
The value of the second correlation coefficient.
The sample size of the first sample from which the first correlation coefficient was computed.
The sample size of the second sample from which the first correlation coefficient was computed.
The type of correlation coefficients, "pearson" or "spearman".
Michail Tsagris
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
The test statistic for the hypothesis of equality of two correlation coefficients is the following:
$$
Z=\frac{\hat{z}_1-\hat{z}_2}{\sqrt{1/\left(n1-3\right)+1/\left(n2-3\right)}},
$$
where \(\hat{z}_1\) and \(\hat{z}_2\) denote the Fisher's transformation (see correl
applied to the two correlation coefficients and \(n_1\) and \(n_2\) denote the sample sizes of the two correlation coefficients. The denominator is the sum of the variances of the two coefficients and as you can see we used a different variance estimator than the one we used before. This function performs hypothesis testing for the equality of two correlation coefficients. The result is the calculated p-value from the standard normal distribution.
correl, correls
y <- rnorm(40)
x <- matrix(rnorm(40 * 1000), ncol = 1000)
a <- correls(y, x )
Run the code above in your browser using DataLab